package client;
// ClientNetworkInputThread.java
// Used by the client
// Sits in a while loop blocking until the server sends data
// which is sent to updateClient() in the WebGameClient passed into the constructor

import java.io.*;
import java.net.*;

class ClientNetworkInputThread implements Runnable
{
	private Socket socket;
	private WebGameClient client;
	private int ID = -1;

	public ClientNetworkInputThread(Socket s, WebGameClient c)
	{
		socket = s;
		client = c;
	}

	public void run()
	{
		try
		{
			ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
			while(true)
			{
				client.updateClient((ServerResponse)in.readObject());
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}